apiVersion: apps/v1
kind: Deployment
metadata:
  name: prometheus-adapter
  namespace: kubesphere-monitoring-system
spec:
  replicas: 1
  selector:
    matchLabels:
      name: prometheus-adapter
  strategy:
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 0
  template:
    metadata:
      labels:
        name: prometheus-adapter
    spec:
      containers:
      - args:
        - --cert-dir=/var/run/serving-cert
        - --config=/etc/adapter/config.yaml
        - --logtostderr=true
        - --metrics-relist-interval=1m
        - --prometheus-url=http://prometheus-k8s.kubesphere-monitoring-system.svc:9090/
        - --secure-port=6443
        image: {{ prometheus_adapter_repo }}:{{ prometheus_adapter_tag }}
        name: prometheus-adapter
        resources:
          limits:
            cpu: {{ monitoring.prometheus_adapter.limits.cpu | default("600m") }}
            memory: {{ monitoring.prometheus_adapter.limits.memory | default("500Mi") }}
          requests:
            cpu: {{ monitoring.prometheus_adapter.requests.cpu | default("200m") }}
            memory: {{ monitoring.prometheus_adapter.requests.memory | default("250Mi") }}
        ports:
        - containerPort: 6443
        volumeMounts:
        - mountPath: /tmp
          name: tmpfs
          readOnly: false
        - mountPath: /var/run/serving-cert
          name: volume-serving-cert
          readOnly: false
        - mountPath: /etc/adapter
          name: config
          readOnly: false
      nodeSelector:
        kubernetes.io/os: linux
      serviceAccountName: prometheus-adapter
      volumes:
      - emptyDir: {}
        name: tmpfs
      - emptyDir: {}
        name: volume-serving-cert
      - configMap:
          name: adapter-config
        name: config
